import request from '@/utils/request'

//  https://api-hmzs.itheima.net/v1/parking/card/list
//  https://api-hmzs.itheima.net/v1/parking/card/list

/**
 * 获取月卡信息列表
 * @param {*} param
 * @returns
 */
export const getCardListAPI = (param) => {
  return request.get('/parking/card/list',
    { params: param })
}

//  https://api-hmzs.itheima.net/v1/parking/card
/**
 * 新增月卡用户
 * @param {*} data
 * @returns
 */
export const addCardAPI = (data) => {
  return request.post('/parking/card',
    data
  )
}

// https://api-hmzs.itheima.net/v1/parking/card/{Id}
/**
 * 获取月卡详情
 *
 * @param {*} id 月卡id
 * @returns
 */
export const getCardDetailAPI = (id) => {
  return request.get(`/parking/card/${id}`)
}

//  https://api-hmzs.itheima.net/v1/parking/card/edit
/**
 * 编辑月卡数据
 *
 * @param {*} data 提交数据
 */
export const editCardAPI = (data) => {
  request.put('/parking/card/edit', data)
}
//  https://api-hmzs.itheima.net/v1/parking/card/{ids}
/**
 * 删除月卡信息
 * @param {*} id 删除月卡id
 * @returns
 */
export function deleteCardAPI(id) {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}
